#include "SleepAction.h"
#include <thread>

SleepAction::SleepAction(const uint32_t& value)
    : IplaybackAction(RecoderType::SLEEP, value)
{

}

void SleepAction::run()
{
    SleepRecoderData& data = std::get<SleepRecoderData>(itsData);
    std::this_thread::sleep_for(std::chrono::milliseconds(data.count_));
}

void SleepAction::serializeJson(nlohmann::json& out)
{
    SleepRecoderData& data = std::get<SleepRecoderData>(itsData);
    out["type"] = 1;
    out["value"] = data.count_;
}
